package edu.nf.vrs.reservation.service;

import com.rabbitmq.client.Channel;
import edu.nf.vrs.reservation.config.RabbitConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.Map;

/**
 * @author Lv
 * @date 2022/3/30
 */
@Service
@Slf4j
public class ReserveDeadLetterService {

    @RabbitListener(queues = RabbitConfig.DEAD_QUEUE_NAME)
    public void receviceDeadMessage(@Payload String json,
                                    @Headers Map<String,Object> headers,
                                    Channel channel) throws IOException {
        log.info("预约异常，转人工处理 =====> " + json );
    }
}
